<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('审核环保承诺书')"/>
    <link rel="stylesheet" th:href="@{/static/js/plugins/jquery-layout/jquery.layout-latest.css}">
</head>
<body class="gray-bg">
<div class="container-div ui-layout-center">
    <div class="row">
        <div class="form-group">
            <div class="col-sm-8" style="margin-left: 16px">
                <input class="btn btn-primary" type="button" onclick="save()" value="确定">
                <button class="btn btn-primary" type="button" onclick="Dialog.closeFrame(window.name)">取 消</button>
            </div>
        </div>
        <div class="col-sm-12" align="centre" style="margin-top: 10px">
            <form class="ibox-content form-horizontal" method="post" id="environCommitFrom"
                  enctype="multipart/form-data">

                <input name="pkId" type="text" th:value="${entity.pkId}" hidden>

                <div class="form-group row">
                    <label class="col-xs-1 control-label">供应商代码：</label>
                    <div class="col-xs-3">
                        <input class="form-control" type="text" th:value="${entity.vendorCode}" name="vendorCode" readonly>
                    </div>
                    <label class="col-xs-1 control-label">供应商名称：</label>
                    <div class="col-xs-3">
                        <input class="form-control" type="text" th:value="${entity.vendorName}" disabled>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label">保证书编号：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control" th:value="${entity.guaranteeCode}" disabled>
                    </div>
                    <label class="col-xs-1 control-label">合同签订日期：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control"
                               th:value="${#dates.format(entity.contractDate,'yyyy-MM-dd')}" disabled>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label">类别：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control" th:value="${entity.type}" disabled>
                    </div>
                    <label class="col-xs-1 control-label">附件（环保承诺书、加盖公章)：</label>
                    <div class="col-xs-3">
                        <a href="#" onclick="dowloadFileById(this)" th:value="${entity.pkId}" th:text="${entity.attach}"
                           style="color:blue;line-height: 3em;"> </a>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label">录入人：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control" th:value="${entity.editor}" disabled>
                    </div>
                    <label class="col-xs-1 control-label">录入时间：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control"
                               th:value="${#dates.format(entity.editDate,'yyyy-MM-dd')}" disabled>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label"><span class="required-sign">*</span>审核人：</label>
                    <div class="col-xs-3">
                        <input type="text" class="form-control" th:value="${entity.reviewer}" readonly>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label"><span class="required-sign">*</span>审核结论：</label>
                    <div class="col-xs-3" style="font-size: 1.3em;">
                        <input name="conclusion" type="radio" value="1" checked>通过
                        <input name="conclusion" type="radio" value="-1">退回
                    </div>
                    <label class="col-xs-1 control-label">审核意见：</label>
                    <div class="col-xs-3">
                        <input name="reviewComment" type="text" class="form-control" autocomplete="off" required>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label">备注：</label>
                    <div class="col-xs-7">
                        <textarea name="remark" class="form-control" style="resize:none;" rows="3"></textarea>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-xs-1 control-label">注意事项：</label>
                    <div class="col-xs-7">
                        <span style="color: red;line-height: 2em;">
                            1.环保承诺书：指厚声合作伙伴与厚声签订的合约书，注意要盖章备案的生效版<br>
                            2.环保承诺书版本：需合作伙伴签订最新版本，最新版本请在平台“管理表单”上下载<br>
                            3.系统提交及审核权限：提交人-合作伙伴质量经理；审核人-厚声SQE马东，联系邮箱：sqe@uniohm.com.电话：0512-57631411-8832
                        </span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<script type="text/javascript" th:src="@{/static/js/plugins/jquery-layout/jquery.layout-latest.js}"></script>

<script type="text/javascript">

    //保存提交的数据
    function save() {
        if ($("#environCommitFrom").valid()) {
            var formData = new FormData($('#environCommitFrom')[0]);
            layer.load(1, {shade: [0.3, '#393D49']});
            $.ajax({
                url: ctxPath + "/environCommitment/saveAudit",
                type: 'POST',
                data: formData, // 上传formdata封装的数据包
                dataType: 'JSON',
                cache: false, // 不缓存
                processData: false, // jQuery不要去处理发送的数据
                contentType: false, // jQuery不要去设置Content-Type请求头
                success: function (data) {
                    layer.closeAll();
                    if (data.code == 0) {
                        Dialog.msg("操作成功!");
                        parent.refresh();
                        Dialog.closeFrame(window.name);
                    } else {
                        Dialog.errorMsg("操作失败，请重试!");
                    }
                }
            });
        }
    }

    /**
     **根据id下载报告文件
     **
     **/
    function dowloadFileById(obj) {
        var id=$(obj).first().attr("value");
        window.location.href = ctxPath + "/environCommitment/downloadFileById?id=" + id;
    }
</script>

</body>
</html>